const request=require('../../../utils/request.js');
const globleurl = require('../../../utils/serverconfig.js').url;
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let userid=parseInt(options.userid);
    this.setData({
      userid
    });

    this.getmycomment();
  },

  async getmycomment(e){
    let commentdata=await request.myrequest('/miniapp/showmycomment',{userid:this.data.userid});
      
      commentdata.data.forEach(item=>{
        item.comment_time=item.comment_time.substr(0,10);
        item.img_url=globleurl+item.img_url;
      })
    this.setData({
      commentdata:commentdata.data
    })
  },


  showdetail(e){
    let movieid=parseInt(e.currentTarget.dataset.movieid);
    wx.navigateTo({
      url: `../../moviedescription/moviedescription?movie_id=${movieid}`,
    })
  }
})